<?php defined('_JEXEC') or die('Restricted access'); ?><?php defined('_SEXEC') or die('Restricted access'); ?>
<?php
if ($task == 'login') {
    if (isset($login)) {
        b($username, "Username is Mandatory");
        b($password, "Passward is Mandatory");
        if (count($arr) == 0) {
            $query = "select * from users where username = '" . $_POST['username'] . "' and password = '" . $_POST['password'] . "'";
            $result = mysql_query($query);
            $count = mysql_num_rows($result);
            if ($count == 0) {
                $arr[] = "Username and password are not Matched";
            } else {
                $row = mysql_fetch_array($result);
                $_SESSION['username'] = $row['username'];
                $_SESSION['usertype'] = $row['usertype'];
            }
        }
    }
}
if ($task == 'logout') {
    $_SESSION = array();
    unset($_SESSION);
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
    <head>
        <title><?php echo $lang['CompanyNameWithBusiness'] ?></title>
        <link rel="stylesheet" href="css/styles.css" type="text/css" />
        <script language="javascript" type="text/javascript" src="js/add_html.js"></script>
        <script language="javascript" type="text/javascript" src="js/jquery-1.3.2.js"></script>
        <script language="javascript">
            function popcal(a)
            {
                var popupcal;
                var popxml = '<importdata><configs><statecfg><dateformat>d-m-Y</dateformat><mindate>2000-01-01</mindate><maxdate><?php echo date('Y-m-d'); ?></maxdate></statecfg><initcfg><name>popupcal</name><mode>popup</mode></initcfg></configs></importdata>';
                popupcal = new EpochPrime(document.getElementById(a), popxml);
                popupcal.setTarget(a);
            }

            function search()
            {
                var cno = $("#cno").val();
                if (cno == "")
                    return false;
                else
                    return true;
            }
        </script>
        <link rel="stylesheet" type="text/css" href="js/calender/epochprime_style.css" />
        <script type="text/javascript" charset="utf8" src="js/calender/epochprime_classes.js"></script>
        <script src="js/calender/Calendar.js"></script>
    </head>
    <body>
        <div id="container">
            <div id="contents">
                <?php
                if (isset($_SESSION['username']) && isset($_SESSION['usertype'])) {
                    ?>
                    <table cellspacing="0" cellpadding="0" width="100%" border=0>
                        <tr>
                            <td style='background-color:#000000;height: 49px;'>
                                <div class="header-search">
                                    <form name="search-form" action="search.php" method="get" onsubmit="javascript:return search()">
                                        Search Courier No.
                                        <input type='text' name='cno' id='cno' style='border:1px solid #C0C25B'/>
                                        <input type='submit' value='Search' style='border:1px solid #C0C25B; font-size:11px;'/>
                                    </form>
                                </div>	
                                <div class="header-link">
                                    <a href='index.php'>Home</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='user.php'>User</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='company.php'>Company</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='slab.php'>Slab</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='destination.php'>Destination</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='entry.php'>Daily Entry</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='inventory.php'>Bulk Entry</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='report.php'>Invoice</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='daily_report.php'>Daily Report</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='month_report.php'>Month Report</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='statement.php'>Statement</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='setting.php'>Setting</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='backup.php'>Backup</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='index.php?task=logout'>Logout</a>
                                </div>
                            </td>
                        </tr>
                    </table>
                    <?php
                }
                ?>
                <p align=center><b><u><font size=3><?php echo $lang['CompanyNameWithBusiness'] ?></font></u></b></p>
                <p align=center><b><u><font size=3>Administrator Panel</font></u></b></p>